/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package br.com.menosehmais.business;

import br.com.caelum.vraptor.ioc.Component;
import br.com.menosehmais.framework.business.CrudBusinessObject;
import br.com.menosehmais.model.ContratoDO;
import br.com.menosehmais.model.EmpresaDO;
import br.com.menosehmais.model.ServicoDeDesignDO;
import br.com.menosehmais.model.ServicoDeMarketingDO;
import br.com.menosehmais.persistence.ContratoDAO;
import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author Junior JAFJ
 */
@Component
public class ContratoBO extends CrudBusinessObject<ContratoDO, ContratoDAO> {

    public ContratoBO(ContratoDAO contratoDAO) {
        super(contratoDAO);
    }

    public List<ContratoDO> listarEmpresaContrato(EmpresaDO empresaDO) {
        ContratoDO contratoDO = new ContratoDO();
        contratoDO.setEmpresa(empresaDO);
        List<ContratoDO> lista = dao.selectUsingFilter(contratoDO);
        return lista;
    }

    public List<ServicoDeDesignDO> listarDesignNaoSelecionado(ContratoDO contratoDO, List<ServicoDeDesignDO> listaServicos) {
        List<ServicoDeDesignDO> listaDiff = new LinkedList<ServicoDeDesignDO>();
        for (ServicoDeDesignDO s : listaServicos) {
            if (!contratoDO.getServicosDesign().contains(s)) {
                listaDiff.add(s);
            }
        }
        return listaDiff;
    }
    
    public List<ServicoDeMarketingDO> listarMarketingNaoSelecionado(ContratoDO contratoDO, List<ServicoDeMarketingDO> listaServicos) {
        List<ServicoDeMarketingDO> listaDiff = new LinkedList<ServicoDeMarketingDO>();
        for (ServicoDeMarketingDO sm : listaServicos) {
            if (!contratoDO.getServicosMarketing().contains(sm)) {
                listaDiff.add(sm);
            }
        }
        return listaDiff;
    }
    
}
